Skip to content

Fix Blazor browser option handling - #70526

Merged
kotlarmilos merged 7 commits into
dotnet:mainfrom
ilonatommy:ilonatommy-blazor-browser-options
Nov 25, 2026
Merged

kotlarmilos merged 7 commits into
dotnet:mainfrom
ilonatommy:ilonatommy-blazor-browser-options

Conversation

@ilonatommy

@ilonatommy ilonatommy commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Fix Blazor browser option handling

Fix five server-configured browser option issues

Description

Fixes the five browser-option problems reported in #70510 while reviewing dotnet/AspNetCore.Docs#38107: the circuit inactivity timeout, WebAssembly culture, DOM preservation, circuit logging, and sub-second reconnection intervals.

  • Circuit inactivity timeout: Read the current SSR timeout when scheduling circuit disposal, rather than capturing the default during boot.
  • WebAssembly culture: Forward the server-configured culture before the WebAssembly runtime loads, while allowing an explicit JavaScript culture to take precedence.
  • DOM preservation: Apply the server option before initial and streamed interactive content activates. When preservation is disabled, enhanced navigation no longer intercepts links or forms; streamed and enhanced POST response content is replaced without retaining the prior DOM, while preserving logical-DOM component activation. A GET that first supplies this setting falls back to a full-page load. The already-submitted POST is not replayed.
  • Circuit logging: Apply the server log level unless startup or an initializer explicitly set the circuit log level.
  • Reconnection interval: Schedule the first retry at the smaller of the configured interval and the one-second display interval, so short configured intervals take effect.

For these settings, explicit startup or initializer values take precedence over server configuration, which takes precedence over framework defaults. The retry change preserves numeric and callback-based JavaScript retry intervals.

Fixes #70510

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Nov 12, 2026
@ilonatommy
ilonatommy marked this pull request as ready for review November 13, 2026 08:11
@ilonatommy
ilonatommy requested a review from a team as a code owner November 13, 2026 08:11
@ilonatommy
ilonatommy requested review from javiercn and oroztocil and a balanced review from Copilot November 13, 2026 08:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The replacement path skips component descriptor registration, leaving streamed components non-interactive, while removing the popstate handler can make Back change the URL without restoring the previous page.

2 open issues
What changed in this PR

This PR addresses #70510 by applying server-configured browser options to Blazor startup, rendering, navigation, and circuit behavior.

Changes:

  • Read shared SSR options when scheduling circuit disposal and applying streaming updates, and refresh navigation listeners when configuration arrives.
  • Forward WebAssembly culture and circuit logging settings, and honor reconnection intervals shorter than one second.
  • Add browser regression tests and supporting test-asset configuration.

Review was source-level; browser tests were not run.

File Description
src/​Components/​Web.JS/​src/​Services/​WebRootComponentManager.ts Reads the configured timeout when scheduling circuit disposal.
src/​Components/​Web.JS/​src/​Services/​NavigationEnhancement.ts Clears programmatic enhanced navigation when detaching listeners.
src/​Components/​Web.JS/​src/​Services/​ComponentDescriptorDiscovery.ts Adds culture to WebAssembly server options.
src/​Components/​Web.JS/​src/​Rendering/​StreamingRendering.ts Reads shared DOM-preservation settings during updates.
src/​Components/​Web.JS/​src/​Platform/​Circuits/​DefaultReconnectionHandler.ts Allows the first retry-timer tick below one second.
src/​Components/​Web.JS/​src/​Boot.WebAssembly.Common.ts Applies server culture while preserving explicit JavaScript precedence.
src/​Components/​Web.JS/​src/​Boot.Web.ts Applies browser configuration to navigation, circuits, and WebAssembly.
src/​Components/​test/​testassets/​Components.WasmMinimal/​Program.cs Allows culture tests to bypass the fixed test culture.
src/​Components/​test/​testassets/​Components.WasmMinimal/​Pages/​BrowserConfigurationEnvVars.razor Displays the active application culture.
src/​Components/​test/​testassets/​Components.TestServer/​RazorComponents/​GlobalInteractivityApp.razor Accepts a JavaScript culture override for tests.
src/​Components/​test/​testassets/​Components.TestServer/​RazorComponentEndpointsStartup.cs Exposes browser-option settings through test configuration.
src/​Components/​test/​E2ETest/​Tests/​ServerBrowserConfigurationTest.cs Adds timeout, navigation, streaming, logging, and retry scenarios.
src/​Components/​test/​E2ETest/​Tests/​BrowserConfigurationTest.cs Checks server-configured culture and JavaScript precedence.

Review effort: Balanced

Comment thread src/Components/Web.JS/src/Boot.Web.ts Resolved
@PureWeen

Copy link
Copy Markdown
Member

/review

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One additional issue remains at 80353778ef33c4622a3e2b40adc4ab0dbddbc381: disabling DOM preservation does not stop the navigation that delivers the setting. The existing comments already cover history traversal and streamed-component registration.

Informational verifier trace, non-blocking: [DISCARDED] Boot.Web.ts:142: static-only responses do not emit browser configuration without an interactive component marker. One verifier discarded this as pre-existing behavior. The follow-up checks did not agree on raising it as a separate defect.

Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block agent-reviewed-approved.

Human-directed and GitHub Copilot-generated.

Comment thread src/Components/Web.JS/src/Boot.Web.ts Resolved
Keep culture, circuit timeout, logging, and retry timing fixes. Preserve explicit startup values over server configuration and add browser coverage for server-only and conflicting options.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@PureWeen

Copy link
Copy Markdown
Member

/review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The startup wait can finish before blazor.web.js loads, allowing StartCounter to fail with Blazor is not defined and making the test flaky.

2 open issues
1 resolved since last review

Review effort: Balanced

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source-only review of frozen head 93cd111e5eb3fefcd91f462683c232864d787f85.

No verified new defect or unresolved candidate remains. The sole specialist candidate was independently checked and discarded because merge-base source proves the same maxRetries override on the exact input sequence; it is surfaced inline for auditability as required by the review contract.

Both routed guides completed: cross-cutting checks covered option precedence, lifecycle, timer behavior, configuration, localization, compatibility, and changed-test fit; Blazor checks covered hosting boundaries, circuits, WebAssembly culture, browser configuration, and E2E source coverage. Existing feedback about DOM preservation, history traversal, and streamed descriptor registration concerns changes absent from this frozen head, so it was not republished or counted as a current duplicate. No unresolved candidates remain.

Provenance: immutable guidance commit dd1062f94f356d6be59ad340e5aff2fd829165c6; merge base 60ef0101bf97cfccb49ede034b38659c15474d1b; base tip dd1062f94f356d6be59ad340e5aff2fd829165c6. Proof is source-only. Target code, tests, CI, browser workflows, and samples were not executed. Security implications were excluded by supplied policy. No materially changed area lacked a routed guide. Limitations: tracked Git bytes only; symlink, submodule, and LFS targets cannot establish behavior, and feedback posted after bundle preparation is not observable.

Generated by ASP.NET Core Pull Request Review for #70526 · copilot · gpt56 · 264.2 AIC · ⌖ 11.3 AIC · ⊞ 18.9K
Comment /review to run again

Comment thread src/Components/Web.JS/src/Boot.Web.ts Resolved

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The local panel found one additional initializer-logging regression at 93cd111e5eb3fefcd91f462683c232864d787f85, reported independently by two of the three review arms.

Informational verifier traces, non-blocking:

  • [UNRESOLVED] src/Components/Web.JS/src/Boot.Web.ts:145: top-level Blazor.start({ logLevel }) does not override the server level for circuit logging. The verifier found no binding contract requiring that precedence; the top-level value did not control circuit logging at merge base either. This is separate from the initializer regression below.
  • [UNRESOLVED] src/Components/Web.JS/src/Boot.Web.ts:155 / src/Components/Web.JS/src/Services/WebRootComponentManager.ts:237: enhanced navigation replaces an initializer-supplied inactivity timeout with the server value. The verifier found no binding initializer-versus-server precedence contract, and merge base ignored both values rather than honoring the initializer.
  • [DISCARDED] src/Components/Web.JS/src/Boot.Web.ts:152,173,177-182: the adjacent DOM-preservation, reconnection-dialog and extension-key precedence concerns were discarded as pre-existing behavior on unchanged lines, not new defects. The related maxRetries trace is already covered by #70526 (comment) and is not repeated here.

Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block agent-reviewed-approved.

Untested coverage gaps: The initializer-plus-enhanced-navigation paths above have no matching permanent regression case in this diff. The panel did not execute those paths.

Routine discarded checks: Other negative checks of the timer, culture, option defaults, lifecycle and test fit produced no additional concrete findings.

Validation boundary: All three arms used frozen-source evidence; none ran scoped target builds, tests, samples or browser validation. Existing author validation claims were not treated as panel execution proof.

Human-directed and GitHub Copilot-generated.

Comment thread src/Components/Web.JS/src/Boot.Web.ts Resolved
ilonatommy and others added 2 commits November 18, 2026 12:21
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@PureWeen

Copy link
Copy Markdown
Member

/review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved regressions drop persisted state during enhanced POST navigation and break existing HEAD and redirect tests.

4 open issues
2 resolved since last review

Review effort: Balanced

Comment thread src/Components/Web.JS/src/Boot.Web.ts Resolved
Comment thread src/Components/Web.JS/src/Boot.Web.ts Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source-only review of frozen head a1973d54d45300da2300e3f2071d7923fd37c483.

One contract-dependent candidate remains inline as unresolved: a beforeWebStart initializer's retry-interval mutation is overwritten by later server browser configuration. The trigger, mutation path, and reconnection effect are established in frozen source, but no assigned binding contract establishes initializer-over-server precedence for this option. Merge-base source already had the same behavior.

Both routed guides completed with gpt-5.6-sol (reasoning effort not supplied; runtime default): cross-cutting checks covered option precedence, lifecycle, timers, configuration, localization, compatibility, and changed-test fit; Blazor checks covered hosting boundaries, navigation/streaming replacement, circuits, WebAssembly culture, reconnection, and E2E source coverage. No materially changed area lacked a routed guide.

Existing-feedback disposition: no supported current-head true positive was republished. The prior streamed-component registration, current-navigation/history, startup-wait, and initializer-logging concerns are addressed in this frozen head according to their threads and frozen source. The existing maxRetries concern is not endorsed as a new defect: old/head comparison shows the same overwrite on the exact input sequence, and the frozen feedback already records that disposition.

Provenance: immutable guidance commit 3a3c6d0b75c1f26c3a4c15cd2b786fb9929c4136; merge base 60ef0101bf97cfccb49ede034b38659c15474d1b; base tip 3a3c6d0b75c1f26c3a4c15cd2b786fb9929c4136. Proof is source-only. Target code, tests, CI, browser workflows, and samples were not executed. Security assessment was excluded by supplied policy. Tracked Git bytes only; symlink, submodule, and LFS targets cannot establish behavior, and feedback posted after bundle preparation is not observable.

Generated by ASP.NET Core Pull Request Review for #70526 · copilot · gpt56 · 292.4 AIC · ⌖ 8.49 AIC · ⊞ 20.1K
Comment /review to run again

Comment thread src/Components/Web.JS/src/Boot.Web.ts Resolved

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One additional cross-request DOM-preservation issue remains at a1973d54d45300da2300e3f2071d7923fd37c483.

Informational verifier trace, non-blocking: [DISCARDED] src/Components/test/E2ETest/Tests/ServerBrowserConfigurationTest.cs:54,329: One arm questioned the wall-clock timing windows. Its verifier rejected the claim because no timing artifact or flaky-test history establishes failures. This is not a request to change these tests.

Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block agent-reviewed-approved.

Untested coverage gaps: The arms did not execute cross-request option isolation, delayed startup with buffered streaming, enhanced POST persisted-state transfer, or initializer retry precedence.

Routine discarded checks: The arms rejected adjacent proxy, culture, timer, DOM-registration, and duplicate-emission concerns from source. Existing startup, persisted-state, and retry-interval comments are not repeated.

Validation boundary: All three arms and both follow-up checks used frozen source. None ran target builds, tests, samples, or browser scenarios.

Human-directed and GitHub Copilot-generated.

Comment thread src/Components/Web.JS/src/Boot.Web.ts Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The changes span lifecycle-sensitive DOM replacement, navigation, and component activation paths, but the source-only review could not run the real-browser Selenium regressions needed to validate them.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@PureWeen

Copy link
Copy Markdown
Member

/review

@PureWeen

Copy link
Copy Markdown
Member

Copilot's local GPT-5.6 review arm found no issues to raise at this commit.

Informational, non-blocking check: Both local guide workers considered whether JavaScript-selected maxRetries and dialogId should retain precedence over server browser configuration. Exact merge-base/head comparison showed those overwrites were already present and this change alters precedence only for retryIntervalMilliseconds; existing feedback at #70526 (comment) also records maxRetries as pre-existing. Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block agent-reviewed-approved.

Validation boundary: Source-only review; no target build, unit test, Selenium/browser test, sample, CI, or runtime validation ran. Untested gaps remain around real-browser timing and lifecycle behavior for enhanced navigation, streaming, form POST replacement, circuit disposal, and reconnection.

Protocol note: Both guide reports were collected and all workers are terminal, but the arm conservatively recorded a collection-invariant deviation because one redundant post-completion read_agent call omitted wait:true before the reports were re-collected correctly.

@kotlarmilos
kotlarmilos merged commit 470b55a into dotnet:main Nov 25, 2026
38 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

✅ No documentation PR was created.

Confidence that documentation is needed: 25%

No docs needed: bug fix to Blazor server-configured browser option handling that aligns behavior with the intended feature. Human review may confirm the precedence rule is covered in the related docs work (dotnet/AspNetCore.Docs#38107).

Documentation surfaces considered

  • Conceptual article: Not required — Bug fix restoring intended behavior of the existing browser options feature (precedence: startup/initializer > server config > defaults); no new public API.
  • Migration guidance: Not required — No upgrade action needed.
  • Breaking change: Not required — No API removal or changed established default; fixes options that weren't taking effect.

@kotlarmilos

Copy link
Copy Markdown
Member

/backport to release/11.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0 (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

@kotlarmilos backporting to release/11.0 failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix Blazor browser option handling
Using index info to reconstruct a base tree...
M	src/Components/Web.JS/src/Boot.Web.ts
M	src/Components/Web.JS/src/Boot.WebAssembly.Common.ts
M	src/Components/Web.JS/src/Services/WebRootComponentManager.ts
M	src/Components/test/E2ETest/Tests/BrowserConfigurationTest.cs
M	src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs
M	src/Components/test/testassets/Components.WasmMinimal/Pages/BrowserConfigurationEnvVars.razor
Falling back to patching base and 3-way merge...
Auto-merging src/Components/Web.JS/src/Boot.Web.ts
Auto-merging src/Components/Web.JS/src/Boot.WebAssembly.Common.ts
Auto-merging src/Components/Web.JS/src/Services/WebRootComponentManager.ts
Auto-merging src/Components/test/E2ETest/Tests/BrowserConfigurationTest.cs
CONFLICT (content): Merge conflict in src/Components/test/E2ETest/Tests/BrowserConfigurationTest.cs
Auto-merging src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs
CONFLICT (content): Merge conflict in src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs
Auto-merging src/Components/test/testassets/Components.WasmMinimal/Pages/BrowserConfigurationEnvVars.razor
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix Blazor browser option handling
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — ffb54a34 Deployed Nov 25, 2026 by kotlarmilos via conclusion #463
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-reviewed-approved area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blazor browser options are ignored or applied incorrectly

6 participants